package com.nbsaas.boot.data.rest.resource;

import com.nbsaas.boot.data.api.apis.QueryTemplateApi;
import com.nbsaas.boot.data.data.entity.QueryTemplate;
import com.nbsaas.boot.data.api.domain.request.QueryTemplateRequest;
import com.nbsaas.boot.data.api.domain.response.QueryTemplateResponse;
import com.nbsaas.boot.data.api.domain.simple.QueryTemplateSimple;
import com.nbsaas.boot.data.rest.convert.QueryTemplateSimpleConvert;
import com.nbsaas.boot.data.rest.convert.QueryTemplateEntityConvert;
import com.nbsaas.boot.data.rest.convert.QueryTemplateResponseConvert;
import com.nbsaas.boot.data.data.repository.QueryTemplateRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   -业务接口实现
*/
@Transactional
@Service
public class QueryTemplateResource extends BaseResource<QueryTemplate,QueryTemplateResponse, QueryTemplateSimple, QueryTemplateRequest>  implements QueryTemplateApi {

    @Resource
    private QueryTemplateRepository queryTemplateRepository;

    @Override
    public JpaRepositoryImplementation<QueryTemplate, Serializable> getJpaRepository() {
        return queryTemplateRepository;
    }

    @Override
    public Function<QueryTemplate, QueryTemplateSimple> getConvertSimple() {
        return new QueryTemplateSimpleConvert();
    }

    @Override
    public Function<QueryTemplateRequest, QueryTemplate> getConvertForm() {
        return new QueryTemplateEntityConvert();
    }

    @Override
    public Function<QueryTemplate, QueryTemplateResponse> getConvertResponse() {
        return new QueryTemplateResponseConvert();
    }




}


